package com.hqyj.freemovie.front.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.JdbcType;

import javax.persistence.*;
import java.util.List;

@Data
@Entity
@Table(name = "users")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Users extends BaseEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @TableId(type = IdType.AUTO)
    private Integer uid; //用户编号

    private String username;

    private String password;

    private String mobile; //注册的手机

    private String birthday; //出生日期

    private String gender; //性别

    private String tokenName; //令牌的名字

    private String tokenValue; //令牌值

    @Transient //这个字段我不参与持久化...
    //这个是Mybatisplus  都是表示这个属性不会映射为数据库表里的字段。
    @TableField(exist = false,jdbcType = JdbcType.BLOB,typeHandler = FastjsonTypeHandler.class)
    //@TableField(exist = false)
    private List<String> permissions; //用户的权限集合;

}
